package show.lmm.demo.springboot_aot.view.response;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 基础 response
 */
@Data
@NoArgsConstructor
public class BaseResponse<T> {

    /**
     * 返回值code
     */
    private int code;

    /**
     * 错误消息
     */
    private String failMsg;

    /**
     * 数据
     */
    public T data;

    public BaseResponse(T data) {
        this(0, "success");
        this.data = data;
    }

    public BaseResponse(int code,String failMsg) {
        this.code = code;
        this.failMsg = failMsg;
    }

    public boolean isSuccess() {
        return code == 0;
    }
}
